﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace ARR.Entities
{
    [Serializable]
    public class ARRException : ApplicationException
    {
        public ARRException(string message) : base(message) { }

        public ARRException(string message, Exception innerException) : base(message, innerException) { }
        
        public ARRException(string message, Exception innerException, ExceptionSeverity severity)
            : base(message, innerException)
        {
            this.Severity = severity;
        }

        public ARRException(string message, ExceptionSeverity severity)
            : base(message)
        {
            this.Severity = severity;
        }

        public ExceptionSeverity Severity { get; set; }
    }

    [Serializable]
    public enum ExceptionSeverity
    {
        Validation = 0,
        Critical = 1,
        Fatal = 2,
        Security = 3,
    }

    [Serializable]
    [DataContract]
    public class ARRExceptionDetail
    {
        public ARRExceptionDetail(string message, ExceptionSeverity severity)
        {
            this.Message = message;
            this.Severity = severity;
        }

        [DataMember]
        public string Message { get; set; }

        [DataMember]
        public ExceptionSeverity Severity { get; set; } 
    }
}
